/* eslint-disable @typescript-eslint/no-empty-object-type */

// import axios from 'axios';
import { requestClient } from '#/api/request';

export namespace QcdefectApi {
  export interface qcdefectListParams {
    pageNum: number;
    pageSize: number;
  }
  export interface Params {}
  export interface Row {
    searchValue: null;
    createBy: string;
    createTime: string;
    updateBy: string;
    updateTime: null | string;
    remark: string;
    params: Params;
    defectId: number;
    defectCode: string;
    defectName: string;
    indexType: string;
    defectLevel: string;
    attr1: null;
    attr2: null;
    attr3: number;
    attr4: number;
  }
  export interface qcdefectListResult {
    total: number;
    rows: Row[];
    code: number;
    msg: string;
  }
}

// 获取缺陷列表
export const getQcdefectList = (data: QcdefectApi.qcdefectListParams) => {
  return requestClient.get<QcdefectApi.qcdefectListResult>(
    '/mes/qc/qcdefect/list',
    { params: data },
  );
};

// 增加缺陷
export const addQcdefect = (data: QcdefectApi.Row) =>
  requestClient.post<QcdefectApi.qcdefectListResult>('/mes/qc/qcdefect', data);

// 删除缺陷
export const deleteQcdefect = (id: string) =>
  requestClient.delete<QcdefectApi.qcdefectListResult>(
    `/mes/qc/qcdefect/${id}`,
  );

// 修改缺陷
export const updateQcdefect = (data: QcdefectApi.Row) =>
  requestClient.put<QcdefectApi.qcdefectListResult>('/mes/qc/qcdefect', data);
